package com.gsn.engine.gdx.assets;

import com.badlogic.gdx.assets.AssetDescriptor;
import com.badlogic.gdx.assets.AssetLoaderParameters;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.assets.loaders.FileHandleResolver;
import com.badlogic.gdx.assets.loaders.SynchronousAssetLoader;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
import com.badlogic.gdx.utils.Array;

public class GsnParticleLoader extends SynchronousAssetLoader<ParticleEffect, GsnParticleLoader.MusicParameter> {
	FileHandleResolver resolver;
	
	public static ParticleEffect loadParticleEffect(FileHandleResolver resolver, String filename){
		ParticleEffect effect = new ParticleEffect();
		FileHandle t1 = resolver.resolve(filename);
		FileHandle t2 = t1.parent();
//		Gdx.app.log(tag, t1.path());
//		Gdx.app.log(tag, t2.path());
		effect.load(t1, t2);
		return effect;
	}
	
	public GsnParticleLoader (FileHandleResolver resolver) {
		super(resolver);
		this.resolver = resolver;
	}

	@Override
	public ParticleEffect load (AssetManager assetManager, String fileName, MusicParameter parameter) {
		return loadParticleEffect(resolver, fileName);
	}

	@Override
	public Array<AssetDescriptor> getDependencies (String fileName, MusicParameter parameter) {
		return null;
	}

	static public class MusicParameter extends AssetLoaderParameters<ParticleEffect> {
	}
}

